feat: with cargo clean
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-11-27 13:42:13 +01:00
parent 8869b75072
commit 015cb6b23a
3 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
use dagger_sdk::Container;
use crate::dagger_middleware::DaggerMiddleware;
use super::RustService;
pub struct CargoClean;
impl CargoClean {
pub fn new() -> Self {
Self {}
}
}
impl DaggerMiddleware for CargoClean {
async fn handle(&self, container: Container) -> eyre::Result<Container> {
Ok(container.with_exec(vec!["cargo", "clean"]))
}
}
pub trait CargoCleanExt {
fn with_cargo_clean(&mut self) -> &mut Self {
self
}
}
impl CargoCleanExt for RustService {
fn with_cargo_clean(&mut self) -> &mut Self {
self.with_stage(super::RustServiceStage::BeforeBuild(Box::new(
CargoClean::new(),
)));
self
}
}