Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::Container;
|
||||
|
||||
@@ -47,6 +49,8 @@ pub trait AptExt {
|
||||
|
||||
impl AptExt for RustService {
|
||||
fn with_apt(&mut self, deps: &[&str]) -> &mut Self {
|
||||
self.with_stage(super::RustServiceStage::BeforeDeps(Box::new(Apt::new().extend(deps))))
|
||||
self.with_stage(super::RustServiceStage::BeforeDeps(Arc::new(
|
||||
Apt::new().extend(deps),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::Container;
|
||||
|
||||
@@ -62,15 +64,14 @@ impl CargoBInstall {
|
||||
#[async_trait]
|
||||
impl DaggerMiddleware for CargoBInstall {
|
||||
async fn handle(&self, container: Container) -> eyre::Result<Container> {
|
||||
let c =
|
||||
container
|
||||
.with_exec(vec!["wget", &self.get_download_url()])
|
||||
.with_exec(vec!["tar", "-xvf", &self.get_archive()])
|
||||
.with_exec(
|
||||
"mv cargo-binstall /usr/local/cargo/bin"
|
||||
.split_whitespace()
|
||||
.collect(),
|
||||
);
|
||||
let c = container
|
||||
.with_exec(vec!["wget", &self.get_download_url()])
|
||||
.with_exec(vec!["tar", "-xvf", &self.get_archive()])
|
||||
.with_exec(
|
||||
"mv cargo-binstall /usr/local/cargo/bin"
|
||||
.split_whitespace()
|
||||
.collect(),
|
||||
);
|
||||
|
||||
let c = self.crates.iter().cloned().fold(c, |acc, item| {
|
||||
acc.with_exec(vec!["cargo", "binstall", &item, "-y"])
|
||||
@@ -98,8 +99,8 @@ impl CargoBInstallExt for RustService {
|
||||
) -> &mut Self {
|
||||
let crates: Vec<String> = crates.into_iter().map(|s| s.into()).collect();
|
||||
|
||||
self.with_stage(super::RustServiceStage::BeforeDeps(
|
||||
Box::new(CargoBInstall::new(self.get_arch(), self.get_os(), version, crates))
|
||||
))
|
||||
self.with_stage(super::RustServiceStage::BeforeDeps(Arc::new(
|
||||
CargoBInstall::new(self.get_arch(), self.get_os(), version, crates),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::Container;
|
||||
|
||||
@@ -28,7 +30,7 @@ pub trait CargoCleanExt {
|
||||
|
||||
impl CargoCleanExt for RustService {
|
||||
fn with_cargo_clean(&mut self) -> &mut Self {
|
||||
self.with_stage(super::RustServiceStage::BeforeBuild(Box::new(
|
||||
self.with_stage(super::RustServiceStage::BeforeBuild(Arc::new(
|
||||
CargoClean::new(),
|
||||
)));
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::Container;
|
||||
|
||||
@@ -32,9 +34,9 @@ pub trait ClapSanityTestExt {
|
||||
|
||||
impl ClapSanityTestExt for RustService {
|
||||
fn with_clap_sanity_test(&mut self) -> &mut Self {
|
||||
self.with_stage(
|
||||
super::RustServiceStage::AfterPackage(Box::new(ClapSanityTest::new(&self.bin_name)))
|
||||
);
|
||||
self.with_stage(super::RustServiceStage::AfterPackage(Arc::new(
|
||||
ClapSanityTest::new(&self.bin_name),
|
||||
)));
|
||||
|
||||
self
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::dagger_middleware::DaggerMiddleware;
|
||||
@@ -95,8 +97,8 @@ pub trait MoldActionExt {
|
||||
|
||||
impl MoldActionExt for RustService {
|
||||
fn with_mold(&mut self, version: impl Into<String>) -> &mut Self {
|
||||
self.with_stage(super::RustServiceStage::AfterDeps(
|
||||
Box::new(MoldInstall::new(self.get_arch(), self.get_os(), version))
|
||||
))
|
||||
self.with_stage(super::RustServiceStage::AfterDeps(Arc::new(
|
||||
MoldInstall::new(self.get_arch(), self.get_os(), version),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::Container;
|
||||
|
||||
@@ -34,7 +36,7 @@ pub trait SqlxExt {
|
||||
|
||||
impl SqlxExt for RustService {
|
||||
fn with_sqlx(&mut self) -> &mut Self {
|
||||
self.with_stage(super::RustServiceStage::BeforeBuild(Box::new(Sqlx::new(
|
||||
self.with_stage(super::RustServiceStage::BeforeBuild(Arc::new(Sqlx::new(
|
||||
self.client.clone(),
|
||||
))));
|
||||
|
||||
|
Reference in New Issue
Block a user