Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0daa1a6
feat: implement cache output parsing and validation for v1 recipes as…
zelosleone Jun 14, 2025
a1d62b6
whitelines
zelosleone Jun 14, 2025
af549e5
whitelines
zelosleone Jun 16, 2025
1257b9a
cleanup
zelosleone Sep 30, 2025
a5a6579
cleanup: remove collecting error(s), we only need one
zelosleone Oct 1, 2025
260b818
will need more polishing and tests
zelosleone Oct 13, 2025
f48e76d
only tests remain, this was big
zelosleone Oct 17, 2025
e55944b
fix tests
zelosleone Oct 18, 2025
e533aaa
unit tests
zelosleone Oct 18, 2025
b4e0a89
e2e tests and fixes
zelosleone Oct 18, 2025
2324b8a
extra fixes
zelosleone Oct 18, 2025
1ec0bd2
Merge remote-tracking branch 'origin/main' into parsing
zelosleone Oct 19, 2025
6a39c94
merge fix
zelosleone Oct 19, 2025
c5f28ee
Merge remote-tracking branch 'origin/main' into parsing
zelosleone Oct 19, 2025
44125e6
hmm
zelosleone Oct 19, 2025
9ef33d0
extra fixes and circular dependency protection
zelosleone Oct 19, 2025
455397a
fixes
zelosleone Oct 19, 2025
92596bf
extra logging
zelosleone Oct 19, 2025
8f94109
unwrap to into diagnostic
zelosleone Oct 19, 2025
ad5ff80
inherit error out outside of output
zelosleone Oct 19, 2025
e145eb4
cleanup
zelosleone Oct 19, 2025
1cab894
fixes
zelosleone Oct 19, 2025
f377e8c
fix
zelosleone Oct 19, 2025
96c4693
binary
zelosleone Oct 19, 2025
ccb6752
fixes
zelosleone Oct 19, 2025
ff5a2b5
cleanup
zelosleone Oct 19, 2025
07ca09a
refactor
zelosleone Oct 19, 2025
13e64b0
windows fix and typo
zelosleone Oct 19, 2025
bf74b7a
extra
zelosleone Oct 19, 2025
12a1e4a
extra
zelosleone Oct 19, 2025
e46b099
windows fix
zelosleone Oct 19, 2025
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
28 changes: 14 additions & 14 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[licenses]
allow = [
"0BSD",
"Apache-2.0 WITH LLVM-exception",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0",
"bzip2-1.0.6",
"CC0-1.0",
"CDLA-Permissive-2.0",
"ISC",
"MIT",
"MPL-2.0",
"Unicode-3.0",
"Zlib",
"0BSD",
"Apache-2.0 WITH LLVM-exception",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0",
"bzip2-1.0.6",
"CC0-1.0",
"CDLA-Permissive-2.0",
"ISC",
"MIT",
"MPL-2.0",
"Unicode-3.0",
"Zlib",
]
confidence-threshold = 0.8
private = { ignore = true }
84 changes: 63 additions & 21 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,35 +124,77 @@ pub async fn run_build(

let directories = output.build_configuration.directories.clone();

let output = if output.recipe.cache.is_some() {
output.build_or_fetch_cache(tool_configuration).await?
} else {
output
.fetch_sources(tool_configuration, apply_patch_custom)
.await
.into_diagnostic()?
// Handle cache outputs first
let mut output = output;
let warn_additional_sources = |output: &Output| {
if !output.recipe.sources().is_empty() && output.finalized_cache_sources.is_some() {
tracing::warn!(
"Output defines sources in addition to cache sources. \
This may overwrite files from the cache. \
Consider using 'target_directory' in source definitions to avoid conflicts."
);
}
};

match (
output.recipe.cache.is_some(),
output.cache_outputs_to_build.is_empty(),
) {
(true, _) => {
output = output.build_or_fetch_cache(tool_configuration).await?;
warn_additional_sources(&output);
}
(false, false) => {
let cache_outputs = output.cache_outputs_to_build.clone();
for cache_output in cache_outputs.iter() {
output = output
.build_or_fetch_cache_output(cache_output, tool_configuration)
.await?;
}
warn_additional_sources(&output);
}
(false, true) => {
output = output
.fetch_sources(tool_configuration, apply_patch_custom)
.await
.into_diagnostic()?;
}
}

let output = output
.resolve_dependencies(tool_configuration, RunExportsDownload::DownloadMissing)
.await
.into_diagnostic()?;

output
.install_environments(tool_configuration)
.await
.into_diagnostic()?;
// Fast-path optimization: When an output inherits from a cache and has no explicit build script,
// we can skip environment installation and script execution entirely. This is a key benefit
// of the outputs-based cache approach as it allows for significant performance
// improvements when building multiple outputs that depend on the same intermediate artifacts.
match (
output.finalized_cache_dependencies.is_some(),
output.recipe.build().script().is_default(),
) {
(true, true) => tracing::info!(
"Using fast-path optimization: output inherited cache and has no build.script; skipping environment setup and script execution for improved performance."
),
_ => {
output
.install_environments(tool_configuration)
.await
.into_diagnostic()?;

match output.run_build_script().await {
Ok(_) => {}
Err(InterpreterError::Debug(info)) => {
tracing::info!("{}", info);
return Err(miette::miette!(
"Script not executed because debug mode is enabled"
));
}
Err(InterpreterError::ExecutionFailed(_)) => {
return Err(miette::miette!("Script failed to execute"));
match output.run_build_script().await {
Ok(_) => {}
Err(InterpreterError::Debug(info)) => {
tracing::info!("{}", info);
return Err(miette::miette!(
"Script not executed because debug mode is enabled"
));
}
Err(InterpreterError::ExecutionFailed(_)) => {
return Err(miette::miette!("Script failed to execute"));
}
}
}
}

Expand Down
Loading