Skip to content

Commit

Permalink
Fix caliptra-sw cold build
Browse files Browse the repository at this point in the history
[Commit](3870341) improves the DPE build
by checking if arbitrary_handles.rs has changed.

Caliptra-sw fails to compile after this change if the build is cold,
since the arbitrary_handles.rs file is never written to if it does not
yet exist.
  • Loading branch information
clundin25 authored and jhand2 committed Feb 21, 2025
1 parent ba301b2 commit 448ce4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dpe/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ fn main() {
let max_handles_str = format!("pub const MAX_HANDLES: usize = {};", arbitrary_max_handles);

let dest_path = PathBuf::from(&dest_path);
if dest_path.exists()
&& std::fs::read_to_string(&dest_path).unwrap_or_default() != max_handles_str
{
std::fs::write(&dest_path, max_handles_str).unwrap();
match std::fs::read_to_string(&dest_path) {
// arbitrary_max_handles.rs already exists with the data we want.
Ok(handles) if handles.contains(&max_handles_str) => (),
_ => std::fs::write(&dest_path, max_handles_str).unwrap(),
}
println!("cargo:rerun-if-changed={}", dest_path.display());
}

0 comments on commit 448ce4e

Please sign in to comment.