This commit is contained in:
nora 2022-10-06 21:31:02 +02:00
commit a2bc92d651
No known key found for this signature in database
10 changed files with 1548 additions and 0 deletions

28
src/build.rs Normal file
View file

@ -0,0 +1,28 @@
use anyhow::{Context, Result};
use std::path::PathBuf;
pub struct Build {
path: PathBuf,
}
impl Build {
pub fn new(path: impl Into<PathBuf>) -> Self {
Self { path: path.into() }
}
pub fn build(&self) -> Result<BuildResult> {
let mut cmd = std::process::Command::new("cargo");
cmd.current_dir(&self.path).arg("build");
let output = cmd.output().context("spawning cargo")?;
Ok(BuildResult {
success: output.status.success(),
})
}
}
pub struct BuildResult {
pub success: bool,
}