Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bootstrap cache path to be set by environment variable #116697

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def download_toolchain(self):
shutil.rmtree(bin_root)

key = self.stage0_compiler.date
cache_dst = os.path.join(self.build_dir, "cache")
cache_dst = os.getenv('RUSTC_BOOTSTRAP_CACHE', os.path.join(self.build_dir, "cache"))
rustc_cache = os.path.join(cache_dst, key)
if not os.path.exists(rustc_cache):
os.makedirs(rustc_cache)
Expand Down
10 changes: 8 additions & 2 deletions src/bootstrap/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,10 @@ impl Config {
key: &str,
destination: &str,
) {
let cache_dst = self.out.join("cache");
let cache_dst = match env::var_os("RUSTC_BOOTSTRAP_CACHE") {
Some(v) => PathBuf::from(v),
None => self.out.join("cache"),
};
let cache_dir = cache_dst.join(key);
if !cache_dir.exists() {
t!(fs::create_dir_all(&cache_dir));
Expand Down Expand Up @@ -656,7 +659,10 @@ download-rustc = false
let llvm_assertions = self.llvm_assertions;

let cache_prefix = format!("llvm-{llvm_sha}-{llvm_assertions}");
let cache_dst = self.out.join("cache");
let cache_dst = match env::var_os("RUSTC_BOOTSTRAP_CACHE") {
Some(v) => PathBuf::from(v),
None => self.out.join("cache"),
};
let rustc_cache = cache_dst.join(cache_prefix);
if !rustc_cache.exists() {
t!(fs::create_dir_all(&rustc_cache));
Expand Down
Loading