Move ci_rustc_dir to Config and use it consistently

This commit is contained in:
jyn 2023-07-05 11:38:55 -05:00
parent baae59eea3
commit 934e7e6c26
4 changed files with 9 additions and 8 deletions

View File

@ -645,8 +645,8 @@ fn cp_rustc_component_to_ci_sysroot(
contents: Vec<String>,
) {
let sysroot = builder.ensure(Sysroot { compiler, force_recompile: false });
let ci_rustc_dir = builder.config.ci_rustc_dir();
let ci_rustc_dir = builder.out.join(&*builder.build.build.triple).join("ci-rustc");
for file in contents {
let src = ci_rustc_dir.join(&file);
let dst = sysroot.join(file);
@ -1381,7 +1381,7 @@ impl Step for Sysroot {
// FIXME: this is wrong when compiler.host != build, but we don't support that today
OsStr::new(std::env::consts::DLL_EXTENSION),
];
let ci_rustc_dir = builder.ci_rustc_dir(builder.config.build);
let ci_rustc_dir = builder.config.ci_rustc_dir();
builder.cp_filtered(&ci_rustc_dir, &sysroot, &|path| {
if path.extension().map_or(true, |ext| !filtered_extensions.contains(&ext)) {
return true;

View File

@ -1800,6 +1800,12 @@ impl Config {
self.out.join(&*self.build.triple).join("ci-llvm")
}
/// Directory where the extracted `rustc-dev` component is stored.
pub(crate) fn ci_rustc_dir(&self) -> PathBuf {
assert!(self.download_rustc());
self.out.join(self.build.triple).join("ci-rustc")
}
/// Determine whether llvm should be linked dynamically.
///
/// If `false`, llvm should be linked statically.

View File

@ -406,7 +406,7 @@ impl Config {
return vec![];
}
let ci_rustc_dir = self.out.join(&*self.build.triple).join("ci-rustc");
let ci_rustc_dir = self.ci_rustc_dir();
let stamp_file = ci_rustc_dir.join(stamp_file);
let contents_file = t!(File::open(&stamp_file), stamp_file.display().to_string());
t!(BufReader::new(contents_file).lines().collect())

View File

@ -819,11 +819,6 @@ impl Build {
self.stage_out(compiler, mode).join(&*target.triple).join(self.cargo_dir())
}
/// Directory where the extracted `rustc-dev` component is stored.
fn ci_rustc_dir(&self, target: TargetSelection) -> PathBuf {
self.out.join(&*target.triple).join("ci-rustc")
}
/// Root output directory for LLVM compiled for `target`
///
/// Note that if LLVM is configured externally then the directory returned