Skip to content

Commit d51b6f9

Browse files
committed
Auto merge of #142816 - Shourya742:2025-06-21-add-caching-layer-to-bootstrap, r=Kobzol
Add caching layer to bootstrap This PR adds a caching layer to the bootstrap command execution context. It is still a work in progress but introduces the initial infrastructure for it. r? `@Kobzol`
2 parents df32e15 + 591df6c commit d51b6f9

File tree

8 files changed

+393
-283
lines changed

8 files changed

+393
-283
lines changed

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ impl Cargo {
131131
}
132132

133133
pub fn into_cmd(self) -> BootstrapCommand {
134-
self.into()
134+
let mut cmd: BootstrapCommand = self.into();
135+
// Disable caching for commands originating from Cargo-related operations.
136+
cmd.do_not_cache();
137+
cmd
135138
}
136139

137140
/// Same as [`Cargo::new`] except this one doesn't configure the linker with

src/bootstrap/src/core/builder/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ use crate::core::build_steps::{
2222
use crate::core::config::flags::Subcommand;
2323
use crate::core::config::{DryRun, TargetSelection};
2424
use crate::utils::cache::Cache;
25-
use crate::utils::exec::{BootstrapCommand, command};
26-
use crate::utils::execution_context::ExecutionContext;
25+
use crate::utils::exec::{BootstrapCommand, ExecutionContext, command};
2726
use crate::utils::helpers::{self, LldThreads, add_dylib_path, exe, libdir, linker_args, t};
2827
use crate::{Build, Crate, trace};
2928

src/bootstrap/src/core/config/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ use crate::core::config::{
4747
};
4848
use crate::core::download::is_download_ci_available;
4949
use crate::utils::channel;
50-
use crate::utils::exec::command;
51-
use crate::utils::execution_context::ExecutionContext;
50+
use crate::utils::exec::{ExecutionContext, command};
5251
use crate::utils::helpers::{exe, get_host_target};
5352
use crate::{GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t};
5453

src/bootstrap/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ use cc::Tool;
3131
use termcolor::{ColorChoice, StandardStream, WriteColor};
3232
use utils::build_stamp::BuildStamp;
3333
use utils::channel::GitInfo;
34-
use utils::execution_context::ExecutionContext;
34+
use utils::exec::ExecutionContext;
3535

3636
use crate::core::builder;
3737
use crate::core::builder::Kind;
3838
use crate::core::config::{DryRun, LldMode, LlvmLibunwind, TargetSelection, flags};
39-
use crate::utils::exec::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, command};
39+
use crate::utils::exec::{BootstrapCommand, command};
4040
use crate::utils::helpers::{
4141
self, dir_is_empty, exe, libdir, set_file_times, split_debuginfo, symlink_dir,
4242
};

src/bootstrap/src/utils/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use std::fs;
99
use std::path::Path;
1010

11-
use super::execution_context::ExecutionContext;
11+
use super::exec::ExecutionContext;
1212
use super::helpers;
1313
use crate::Build;
1414
use crate::utils::helpers::t;

0 commit comments

Comments
 (0)