Skip to content

Commit

Permalink
Do Not Merge:build: Workaround for race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Feb 5, 2024
1 parent 297c670 commit 01750a5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ fn main() {
})
.collect();

// Debug helper for https://github.com/RIOT-OS/riotdocker/issues/242
let preprocessor_include = cflags.iter().filter_map(|f| f.strip_prefix("-I")).filter(|f| f.ends_with("/preprocessor")).next();
if let Some(preprocessor_include) = preprocessor_include {
let filename = format!("{}/preprocessor_successor.h", preprocessor_include);
let mut countdown: usize = 10;
loop {
if std::path::PathBuf::from(&filename).exists() {
break;
}
countdown = countdown.checked_sub(1).unwrap_or_else(|| {
panic!("Preprocessor include path {} was present but preprocessor_successor.h did not show up there after 20 seconds", filename);
});
std::thread::sleep(std::time::Duration::from_secs(2));
}
}

let bindings = builder()
.header("riot-bindgen.h")
.clang_args(&cflags)
Expand Down

0 comments on commit 01750a5

Please sign in to comment.