mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-15 00:45:02 +01:00
lol
This commit is contained in:
commit
a2bc92d651
10 changed files with 1548 additions and 0 deletions
28
src/build.rs
Normal file
28
src/build.rs
Normal 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,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue