Skip to content

Commit 8324260

Browse files
committed
feat(compile): panic when compiled commands is empty
1 parent 9288671 commit 8324260

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/compile.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,16 @@ pub async fn update_compilation_file(root: &path::PathBuf) -> Result<()> {
109109
use crate::xcode::fresh_build;
110110
use tokio_stream::StreamExt;
111111

112-
let steps = fresh_build(&root).await?.collect::<Vec<Step>>().await;
113112
// TODO(build): Ensure that build successed. check for Exit Code
114-
let json = generate_from_steps(&steps)
115-
.await?
116-
.pipe(|cmd| serde_json::to_vec_pretty(&cmd.0))?;
113+
let steps = fresh_build(&root).await?.collect::<Vec<Step>>().await;
114+
let compile_commands = steps.pipe_ref(generate_from_steps).await?;
115+
if compile_commands.is_empty() {
116+
let msg = format!("No compile commands generated\n{:#?}", steps);
117+
anyhow::bail!("{msg}")
118+
}
117119

118-
tokio::fs::write(root.join(".compile"), json)
119-
.await
120-
.context("Write CompileCommands")?;
120+
let json = serde_json::to_vec_pretty(&compile_commands)?;
121+
tokio::fs::write(root.join(".compile"), &json).await?;
121122

122123
Ok(())
123124
}

0 commit comments

Comments
 (0)