Skip to content

Commit bebe11d

Browse files
committed
add caching info on bootstrap command
1 parent 5735674 commit bebe11d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ pub struct CommandCacheKey {
7171
///
7272
/// Bootstrap will print a debug log to stdout if the command fails and failure is not allowed.
7373
///
74+
/// By default, command executions are cached based on their workdir, program, arguments, and environment variables.
75+
/// This avoids re-running identical commands unnecessarily, unless caching is explicitly disabled.
76+
///
7477
/// [allow_failure]: BootstrapCommand::allow_failure
7578
/// [delay_failure]: BootstrapCommand::delay_failure
7679
pub struct BootstrapCommand {

src/bootstrap/src/utils/execution_context.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,15 @@ impl ExecutionContext {
122122
stdout: OutputMode,
123123
stderr: OutputMode,
124124
) -> DeferredCommand<'a> {
125+
command.mark_as_executed();
125126
let cache_key = command.cache_key();
126127

127128
if let Some(cached_output) = cache_key.as_ref().and_then(|key| self.command_cache.get(key))
128129
{
129-
command.mark_as_executed();
130-
131130
self.verbose(|| println!("Cache hit: {command:?}"));
132-
133131
return DeferredCommand { state: CommandState::Cached(cached_output) };
134132
}
135133

136-
command.mark_as_executed();
137-
138134
let created_at = command.get_created_location();
139135
let executed_at = std::panic::Location::caller();
140136

@@ -254,7 +250,6 @@ impl<'a> DeferredCommand<'a> {
254250
};
255251

256252
let created_at = command.get_created_location();
257-
let executed_at = executed_at;
258253

259254
let mut message = String::new();
260255

0 commit comments

Comments
 (0)