Skip to content

Commit 3d3534d

Browse files
committed
add download context
1 parent 052114f commit 3d3534d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/bootstrap/src/core/download.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,43 @@ download-rustc = false
852852
}
853853
}
854854

855+
/// Only should be used for pre config initialization downloads.
856+
pub(crate) struct DownloadContext<'a> {
857+
host_target: TargetSelection,
858+
out: &'a Path,
859+
patch_binaries_for_nix: Option<bool>,
860+
exec_ctx: &'a ExecutionContext,
861+
verbose: bool,
862+
stage0_metadata: &'a build_helper::stage0_parser::Stage0,
863+
llvm_assertions: bool,
864+
bootstrap_cache_path: &'a Option<PathBuf>,
865+
is_running_on_ci: bool,
866+
dry_run: bool,
867+
}
868+
869+
impl<'a> AsRef<DownloadContext<'a>> for DownloadContext<'a> {
870+
fn as_ref(&self) -> &DownloadContext<'a> {
871+
self
872+
}
873+
}
874+
875+
impl<'a> From<&'a Config> for DownloadContext<'a> {
876+
fn from(value: &'a Config) -> Self {
877+
DownloadContext {
878+
host_target: value.host_target,
879+
out: &value.out,
880+
patch_binaries_for_nix: value.patch_binaries_for_nix,
881+
exec_ctx: &value.exec_ctx,
882+
verbose: value.verbose > 0,
883+
stage0_metadata: &value.stage0_metadata,
884+
llvm_assertions: value.llvm_assertions,
885+
bootstrap_cache_path: &value.bootstrap_cache_path,
886+
is_running_on_ci: value.is_running_on_ci,
887+
dry_run: value.dry_run(),
888+
}
889+
}
890+
}
891+
855892
fn path_is_dylib(path: &Path) -> bool {
856893
// The .so is not necessarily the extension, it might be libLLVM.so.18.1
857894
path.to_str().is_some_and(|path| path.contains(".so"))

0 commit comments

Comments
 (0)